﻿@namespace MudBlazor
@inherits MudComponentBase

<div @attributes="UserAttributes" class="@Classname" style="@Style" @onclick="@OnClickHandler">
    @if (!String.IsNullOrEmpty(Avatar))
    {
        <MudAvatar Class="@AvatarClass" Color="@Color">
            <MudIcon Icon="@Avatar" />
        </MudAvatar>
    }
    else if (!String.IsNullOrEmpty(Icon) && !IsChecked)
    {
        <MudIcon Icon="@Icon" Class="mud-chip-icon" Size="Size.Small" Color="@IconColor" />
    }
    else if (IsChecked)
    {
        <MudIcon Icon="@Icons.Material.Filled.Check" Class="mud-chip-icon" Size="Size.Small" />
    }
    <span class="mud-chip-content">
        @if (ChildContent == null)
        {
            @Text
        }
        else
        {
            @ChildContent
        }
        @if (OnClose.HasDelegate || ChipSet?.AllClosable==true)
        {
            <MudIconButton Class="mud-chip-close-button" Icon="@(String.IsNullOrEmpty(CloseIcon) ? $"{Icons.Material.Filled.Cancel}" : $"{CloseIcon}")" OnClick="OnCloseHandler" Size="Size.Small"/>
        }
    </span>
</div>
